<?php
function gcd($a, $b) {
	while ($b != 0) {
		$r = $a%$b;
		$a = $b;
		$b = $a;
	}
	return $a;
}

function swap(&$a, &$b) {
	$t = $a;
	$a = $b;
	$b = $t;
}

$a = 5;
$b = 10;
swap($a, $b);

echo "a = $a b = $b";

function hanoi($n, $A, $B, $C) {
	if($n > 0) {
		hanoi($n - 1, $A, $C, $B);
		echo "$A -> $B<br />";
		hanoi($n - 1, $C, $B, $A);
	}
}

hanoi(6, 'A', 'B', 'C');		
?>